<script type="text/javascript">
    function checkLogin()
 {
     alert('您还没有登陆');
     return false;
 }
   function godownload(dowloadid)
    {
        window.location.href = 'main/courseware/download_courseware.php?courseware_id='+dowloadid;
    }
    </script>
<div id="indexcates">
         <?php
                global $db;
                $teacher_id = $_GET['teacher_id'];
                $sql_courseware = "select cw.id as courseid,cw.title as title,cw.times as times,cw.intotime as intotime,cw.introduction as introduction,mb.realname as realname,mb.id as teacherid from nettteach_courseware cw,nettteach_member mb where cw.writerid = mb.id and mb.id='".$teacher_id."' and cw.state ='0' ";
                $result_courseware = $db -> query($sql_courseware);
                $recordcount = $db -> num_rows($result_courseware);
                @$page=$_GET['p'];
                if ($page==null){$page=1;}
                $pagesize=15;								//每页显示数
                $pagecount=ceil($recordcount/$pagesize);	//计算总页
                if ($page>$pagecount){$page=$pagecount;}
                if ($page<1){$page=1;}
                 $i=($page-1)*($pagesize);
        ?>
        <div class="span9">
        <div class="row-fluid" style="margin-top:10px;">
            <ul class="breadcrumb">
                <li><?php echo (fs_get_objinfo(nettteach_member, id, $teacher_id, realname))?> &nbsp;老师 </li>
            </ul>
        </div>	
        
    <div align="left" style="padding:5px;">
      <table border="0" cellpadding="0" cellspacing="0" class="breadcrumb" align="center" width="100%">
        <tr align="center">
          <td style="line-height:2em;" nowrap>序号</td>
          <td nowrap>课件标题</td>
          <td nowrap>课件简介</td>
          <td nowrap>所属教师</td>
	  <td nowrap>发布时间</td>
          <td nowrap>点击次数</td>
          <td nowrap>操 作</td>
        </tr>
        <tr>
		<td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
	</tr>
<?php
        $courseware_result=$db->query($sql_courseware." limit ".($page-1)*($pagesize).",$pagesize");
	while($courseware_row = $db->fetch_array($courseware_result))
	{
                $i++;
?>
		<tr  onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='FFFFFF'"  align="center">
			<td style="line-height:2em;"><?php echo ($i)?> </td>
                        <td><?php echo ($courseware_row['title'])?> </td>
                        <td><?php echo ($courseware_row['introduction'])?> </td>
                        <td><?php echo ($courseware_row['realname'])?> </td>
                        <td><?php echo date('Y-m-d',$courseware_row['intotime'])?> </td>
			<td><?php echo ($courseware_row['times'])?> </td>
			<td><input type="button"  <?php if($_SESSION['sid']==''){echo 'onclick="checkLogin()"';}else{echo 'onclick="godownload('.$courseware_row["courseid"].')"';}?> class="kaoshi" value="点击下载" /></td>
		</tr>
		<tr>
			<td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
		</tr>
<?php
	}
?>
	</table>
	
	
	
</div>
	<center>
<?php
/*分页示例:

pager(传入URL , 数据总数 , 开始条数 , 每页数目)
*/
echo(pager('?do=coursewarelist&p={page}&teacher_id='.$teacher_id,$recordcount,($page-1)*($pagesize),$pagesize));		
?>
</center>
	</td>
</div>
    
</div>
